package com.tengju.support.domain.model.wx;

import lombok.AllArgsConstructor;
import org.springframework.util.StringUtils;

@AllArgsConstructor
public enum Gender {

    UNKNOWN("0","未定义"),
    MALE("1","男性"),
    FEMALE("2","女性"),
    ;

    String val;
    String desc;

    public String getVal() {
        return val;
    }

    public String getDesc() {
        return desc;
    }

    public static Gender fromVal(String val) {
        if (StringUtils.isEmpty(val)) {
            return null;
        }
        for (Gender gender : values()) {
            if (gender.val.equals(val)) {
                return gender;
            }
        }
        return null;
    }
}
